1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $name=$_POST[
'name'];
4     $thutu=$_POST[
'thutu'];
5     $parent=$_POST[
'parent'];
6     $status=($_POST[
'chkShow']!=''?1:0);
7             
8     $name = trim($_POST[
'name']);
9     
if ($name=="")
10     {
11         echo
"<p align=center class='err'>B&#7841;n ch&#432;a nh&#7853;p tên danh m&#7909;c</p>";
12     }
13     
else
14     {
15         
if (!empty($_POST['oldid'])) {
16             $oldid = $_POST[
'oldid'];
17             $sql =
"update news_cat set name='".$name."', parent='".$parent."', thutu='".$thutu."', status='".$status."' where id='".$oldid."'";
18         }
19         
else
20             $sql =
"insert into news_cat (name,parent,status,thutu,date) values ('".$name."','".$parent."','".$status."','".$thutu."',SYSDATE())";
21         
if (mysql_query($sql,$con)) {
22             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
23             echo
"<script>window.location='index.php?act=news_category&page=".$_REQUEST['page']."&code=1'</script>";
24         }
25         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
26         
27     }
28 }
29 ?>
30
31 <?
32     
if (isset($_GET['id'])) {
33         $oldid=$_GET[
'id'];
34         $sql =
"select * from news_cat where id='".$oldid."'";
35         
if ($result = mysql_query($sql,$con)) {
36             $row=mysql_fetch_array($result);
37             $name=$row[
'name'];
38             $parent=$row[
'parent'];
39             $sortorder=$row[
'thutu'];
40         }
41     }
42 ?>
43 <script language=
"Javascript1.2"><!-- // load htmlarea
44 _editor_url =
"htmlarea/"; // URL to htmlarea files
45 var
win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
46 if
(navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
47 if
(navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
48 if
(navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
49 if
(win_ie_ver >= 5.5) {
50   document.write(
'<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
51   document.write(
' language="Javascript1.2"></scr' + 'ipt>');
52 }
else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
53 // --></script>

54
55 <form method=
"POST" action="index.php?">
56 <input type=hidden name=
"act" value="news_category_m">
57 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
58 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
59 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
60   <tr>
61     <td width=
"45%" height="20" class="title" align="center">Thêm m&#7899;i / C&#7853;p nh&#7853;t
62     : Danh m&#
7909;c tin tuc</td>
63   </tr>
64   <tr>
65     <td width=
"45%">
66     <table border=
"0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67       <tr>
68         <td width=
"15%" class="smallfont">
69         <p align=
"right">Tên danh m&#7909;c</td>
70         <td width=
"1%" class="smallfont">
71         <font color=
"#FF0000">*</font></td>
72         <td width=
"83%" class="smallfont">
73         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="name" CLASS=textbox size="34"></td>
74       </tr>
75       <tr>
76         <td width=
"15%" class="smallfont" align="right">
77         Không hi&#
7875;n th&#7883;</td>
78         <td width=
"1%" class="smallfont" align="right">
79         &nbsp;</td>
80         <td width=
"83%" class="smallfont">
81         <input type=
"checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
82       </tr>
83           <tr>
84         <td width=
"15%" class="smallfont" align="right">
85         Thu&#
7897;c danh m&#7909;c</td>
86         <td width=
"1%" class="smallfont" align="center">&nbsp;
87         </td>
88         <td width=
"83%" class="smallfont">
89         <
select size="1" name="parent" >
90         <option
value="0">Danh mục gốc</option>
91 <?
92         $cats=GetListCatNews_admin(
0);
93         
foreach ($cats as $cat)
94         {
95             
if ($cat[0]==$parent)
96                 echo
"<option value=".$cat[0]." selected>".$cat[1]."</option>";
97             
else
98                 echo
"<option value=".$cat[0].">".$cat[1]."</option>";
99         }
100 ?>
101         </
select>
102         </td>
103       </tr>
104
105         <td width=
"15%" class="smallfont" align="right" valign="top">
106         Th&#
7913; t&#7921; s&#7855;p x&#7871;p</td>
107         <td width=
"1%" class="smallfont">
108         &nbsp;</td>
109         <td width=
"83%" class="smallfont">
110         <INPUT
value="<? echo $thutu; ?>" TYPE="text" NAME="thutu" CLASS=textbox size="4"></td>
111       </tr>
112       <tr>
113         <td width=
"15%" class="smallfont">
114         <p align=
"right">
115         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
116         <td width=
"1%" class="smallfont">
117         &nbsp;</td>
118         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
119       </tr>
120       
121     </table>
122     </td>
123   </tr>
124   </table>
125 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.927 lượt xem

Gõ tìm kiếm nhanh...